import { numberMap } from '@/config/markSixConfig.js'
import { lhcDesStyleStore, lhcNumberStyleStore } from './styleStore'

export interface NumberItem {
  number: string
  des: string
  numberStyle?: object
  desStyle?: object
}

//  处理六合彩的号码样式
export const handleLhcStyle = (winNumber: string[]): NumberItem[] => {
  const numArr: NumberItem[] = winNumber.map((num, index) => {
    const obj: NumberItem = {
      number: num,
      des: numberMap[num].animal,
      numberStyle: {},
      desStyle: {},
    }
    obj.desStyle = lhcDesStyleStore[numberMap[num].color]
    obj.numberStyle =
      index === winNumber.length - 1
        ? lhcNumberStyleStore[numberMap[num].color].special
        : lhcNumberStyleStore[numberMap[num].color].normal
    return obj
  })
  return numArr
}

// 其他游戏常用的样式
export const handleCommonStyle = (winNumber: string[], showDes: boolean = false): NumberItem[] => {
  const numArr = winNumber.map((num, index) => {
    const obj: NumberItem = {
      number: num,
      des: '',
      numberStyle: {},
      desStyle: {},
    }
    if (showDes) {
      obj.des = Number(num) % 2 === 0 ? '双' : '单'
    }
    obj.numberStyle = index === winNumber.length - 1 ? {} : {}
    return obj
  })
  return numArr
}
